home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
051-075
/
disk_071
/
pwdemo
/
example.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
3KB
|
97 lines
/* EXAMPLE.C written 09/15/86 by Martin Murray */
/* *****************************************************************************
* THIS CODE IS IN NO WAY COPYRIGHT 1986 BY INOVATRONICS, INC. IN FACT, *
* YOU CAN DO ANYTHING WITH IT THAT YOU WANT TO DO. JUST REMEMBER, *
* INOVATRONICS, INC. WILL BEAR ABSOLUTELY NO RESPONSIBILITY FOR THE USE, *
* MISUSE, INABILITY TO USE OR INABLITY TO UNDERSTAND ANY OR ALL PARTS OF *
* THIS CODE. ENJOY IT IN GOOD HEALTH. *
********************************************************************************
********************************************************************************
* THE PURPOSE OF THE CODE IS TO LET YOU SEE WHAT YOUR PowerWindows *
* GENERATED SOURCE CODE WILL LOOK LIKE IN A PROGRAM. IN MOST CASES, ALL *
* YOU SHOULD HAVE TO DO IS COMPILE THIS FILE. IT WILL AUTOMATICALLY *
* INCLUDE YOUR SOURCE FILE, PROVIDED IT IS IN THE DEFAULT DIRECTORY, AND *
* IS NAMED "example.h". JUST COMPILE IT, LINK IT AND RUN IT. IT *
* DEFAULTS TO TERMINATING WHEN THE CLOSE GADGET IS HIT, BUT IF YOU LOOK *
* BELOW YOU'LL SEE HOW TO MAKE IT TERMINATE ON ANY EVENT AT ALL. *
***************************************************************************** */
/* INCLUDES ********************************************************** */
#include "exec/types.h"
#include "exec/io.h"
#include "exec/memory.h"
#include "libraries/dos.h"
#include "intuition/intuition.h"
#include "example.h"
/* EXTERNALS ***************************************************** */
extern struct Window *OpenWindow();
/* GLOBALS ****************************************************** */
long IntuitionBase=0;
main()
{
ULONG class;
struct Window *wG; /* we fetch the RastPort pointer from here */
struct RastPort *rpG;
struct IntuiMessage *message; /* the message the IDCMP sends us */
IntuitionBase = OpenLibrary("intuition.library", 0);
if (IntuitionBase == NULL)
{
printf("intuition is not here. where are we?\n");
goto cleanup1;
}
wG = OpenWindow(&NewWindowStructure); /* open the window */
if ( wG == NULL )
{
printf ("open window failed\n");
goto cleanup1;
}
rpG = wG->RPort; /* get a rastport pointer for the window */
#ifdef MenuList
SetMenuStrip(wG,&MenuList); /* attach any Menu */
#endif
#ifdef ITextList
PrintIText(rpG,&ITextList,0,0); /* Print the text if there is any */
#endif
#ifdef BorderList
DrawBorder(rpG,&BorderList,0,0); /* Draw the borders if there are any */
#endif
do
{
WaitPort(wG->UserPort);
while( (message = (struct IntuiMessage *)
GetMsg(wG->UserPort) ) != NULL)
{
class = message->Class;
ReplyMsg(message);
if ( class == CLOSEWINDOW ) goto cleanup2;
}
} while (1);
cleanup2:
#ifdef MenuList
ClearMenuStrip(wG);
#endif
CloseWindow(wG);
cleanup1:
if (IntuitionBase != NULL) CloseLibrary(IntuitionBase);
return(0);
}